package UnitTest.DataStructureTest.arrayAndListTest.listTest.listReverseTest;

import DataStructure.arrayAndList.list.Nodelj;

/**
 * @author liujun
 * @version 1.0
 * @date 2021/12/7
 * @author—Email ljfirst@mail.ustc.edu.cn
 * @blogURL https://blog.csdn.net/ljfirst
 * @description 单链表反转 测试数据
 */
public class ListReverseDate {

    public int[] array01 = null;
    public Nodelj list01 = null;
    public int[] array_SwapPairs_01 = null;
    public int[] array_Reverse_01 = ArrayRevise(array01);
    public int[] array01_Reverse_3_5 = null;

    public int[] array02 = {};
    public Nodelj list02 = null;
    public int[] array_SwapPairs_02 = {};
    public int[] array_Reverse_02 = ArrayRevise(array02);
    public int[] array02_Reverse_3_5 = {};

    public int[] array03 = {1};
    public Nodelj list03 = Nodelj.Array2Nodelj(array03);
    public int[] array_SwapPairs_03 = {1};
    public int[] array_Reverse_03 = ArrayRevise(array03);
    public int[] array03_Reverse_3_5 = {1};

    public int[] array04 = {1, 2};
    public Nodelj list04 = Nodelj.Array2Nodelj(array04);
    public int[] array_SwapPairs_04 = {2, 1};
    public int[] array_Reverse_04 = ArrayRevise(array04);
    public int[] array04_Reverse_3_5 = {1, 2};

    public int[] array05 = {1, 2, 3};
    public Nodelj list05 = Nodelj.Array2Nodelj(array05);
    public int[] array_SwapPairs_05 = {2, 1, 3};
    public int[] array_Reverse_05 = ArrayRevise(array05);
    public int[] array05_Reverse_3_5 = {1, 2, 3};

    public int[] array06 = {1, 2, 3, 4};
    public Nodelj list06 = Nodelj.Array2Nodelj(array06);
    public int[] array_SwapPairs_06 = {2, 1, 4, 3};
    public int[] array_Reverse_06 = ArrayRevise(array06);
    public int[] array06_Reverse_3_5 = {1, 2, 4, 3};

    public int[] array07 = {1, 2, 0, 3, 5, 1, 2, 0, 3, 6};
    public Nodelj list07 = Nodelj.Array2Nodelj(array07);
    public int[] array_SwapPairs_07 = {2, 1, 3, 0, 1, 5, 0, 2, 6, 3};
    public int[] array_Reverse_07 = ArrayRevise(array07);
    public int[] array07_Reverse_3_5 = {1, 2, 5, 3, 0, 1, 2, 0, 3, 6};

    public int[] array08 = {1, 2, 3, 4, 5, 6, 7, 8, 7, 6, 5, 4, 3, 2, 1};
    public Nodelj list08 = Nodelj.Array2Nodelj(array08);
    public int[] array_SwapPairs_08 = {2, 1, 4, 3, 6, 5, 8, 7, 6, 7, 4, 5, 2, 3, 1};
    public int[] array_Reverse_08 = ArrayRevise(array08);
    public int[] array08_Reverse_3_5 = {1, 2, 5, 4, 3, 6, 7, 8, 7, 6, 5, 4, 3, 2, 1};

    public int[] array09 = {1, 2, 3, 4, 5};
    public Nodelj list09 = Nodelj.Array2Nodelj(array09);
    public int[] array_SwapPairs_09 = {2, 1, 4, 3, 5};
    public int[] array_Reverse_09 = ArrayRevise(array09);
    public int[] array09_Reverse_3_5 = {1, 2, 5, 4, 3};


    public int[] array10 = {1, 2, 3, 4};
    public Nodelj list10 = Nodelj.Array2Nodelj(array10);
    public int[] array_SwapPairs_10 = {2, 1, 4, 3};
    public int[] array_Reverse_10 = ArrayRevise(array10);

    public int[] array11 = {1, 2, 3, 4, 5};
    public Nodelj list11 = Nodelj.Array2Nodelj(array11);
    public int[] array_SwapPairs_11 = {2, 1, 4, 3, 5};
    public int[] array_Reverse_11 = ArrayRevise(array11);

    public int[] array12 = {0, 1, 2, 3, 4};
    public Nodelj list12 = Nodelj.Array2Nodelj(array12);
    public int[] array_SwapPairs_12 = {1, 0, 3, 2, 4};
    public int[] array_Reverse_12 = ArrayRevise(array12);

    public int[] array13 = {85, 4, 5, 67, 8};
    public Nodelj list13 = Nodelj.Array2Nodelj(array13);
    public int[] array_SwapPairs_13 = {4, 85, 67, 5, 8};
    public int[] array_Reverse_13 = ArrayRevise(array13);

    public int[] array14 = {1, 4, 4, 4, 4, 5, 5};
    public Nodelj list14 = Nodelj.Array2Nodelj(array14);
    public int[] array_SwapPairs_14 = {4, 1, 4, 4, 5, 4, 5};
    public int[] array_Reverse_14 = ArrayRevise(array14);

    public int[] array15 = {1, 2, 3, 4, 5};
    public Nodelj list15 = Nodelj.Array2Nodelj(array15);
    public int[] array15_Reverse_1_2 = {2, 1, 3, 4, 5};

    public int[] array16 = {1, 2, 3, 4, 5};
    public Nodelj list16 = Nodelj.Array2Nodelj(array16);
    public int[] array16_Reverse_1_100 = {5, 4, 3, 2, 1};

    public int[] array17 = {1, 2, 3, 4, 5};
    public Nodelj list17 = Nodelj.Array2Nodelj(array17);
    public int[] array17_Reverse__2 = {2, 1, 3, 4, 5};

    public int[] array18 = {1, 2};
    public Nodelj list18 = Nodelj.Array2Nodelj(array18);
    public int[] array18_Reverse_1_2 = {2, 1};

    public int[] ArrayRevise(int[] array) {
        if (array == null || array.length == 0) {
            return array;
        }
        int[] arrayNew = new int[array.length];
        int length = array.length - 1;
        for (int i = 0; i <= length / 2; i++) {
            arrayNew[i] = array[length - i];
            arrayNew[length - i] = array[i];
        }
        return arrayNew;
    }
}
